﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace BattleforgeAssault
{
    public class CardPanel : SpacingPanel
    {
        public CardPanel()
        {
            this.Background = new SolidColorBrush(Colors.Transparent);

            this.MouseEnter += OnMouseEnter;
            this.MouseLeave += OnMouseLeave;
        }


        void OnMouseEnter(object sender, MouseEventArgs e)
        {
            UIElement element = e.OriginalSource as UIElement;

            if (!(element is CardPanel))
            {
                e.ToString();
            }

            if (element != null && Children.Contains(element))
            {
                this.Background = new SolidColorBrush(Color.FromArgb(96, 255, 255, 255));
            }
        }

        void OnMouseLeave(object sender, MouseEventArgs e)
        {
            this.Background = new SolidColorBrush(Colors.Transparent);
        }

        void OnMouseEnterChild(object sender, MouseEventArgs e)
        {
            this.Background = new SolidColorBrush(Color.FromArgb(96, 255, 255, 255));
        }

        void OnMouseLeaveChild(object sender, MouseEventArgs e)
        {
            this.Background = new SolidColorBrush(Colors.Transparent);
        }
    }
}
